var n = getApp(), e = void 0;

Page({
    data: {
        navigator: [ {
            icon: "/img/order.png",
            label: "订单",
            url: "/pages/order/order",
            show: !0
        }, {
            icon: "/img/gift.png",
            label: "邀请有礼",
            url: "/pages/mine/retail/retail",
            show: !1
        }, {
            icon: "/img/question.png",
            label: "用户指南",
            url: "/pages/text/text?title=用户指南&url=user_pointer",
            show: !0
        }, {
            icon: "/img/runman.png",
            label: "成为跑男",
            url: "/pages/runman/register/register",
            show: !0
        }, {
            icon: "/img/invoice.png",
            label: "开票与报销",
            show: !1
        }, {
            icon: "/img/cphone.png",
            label: "变更手机号",
            url: "/pages/mine/changePhone/changePhone",
            show: !0
        }, {
            icon: "/img/change.png",
            label: "切换为跑男版",
            change: !0,
            show: !1
        }, {
            icon: "/img/agent.png",
            label: "代理中心",
            url: "/pages/agent/agent",
            show: !1
        } ]
    },
    onLoad: function(n) {
        e = this;
    },
    onShow: function() {
        n.isPhoneExist("redirectTo") && this.getOwnMsg();
    },
    changePage: function() {
        wx.showModal({
            title: "提示",
            content: "您确定要切换版本吗？",
            success: function(n) {
                n.confirm && (wx.setStorageSync("page", "/pages/runman/order/order"), wx.navigateBack({
                    delta: 1,
                    success: function() {
                        wx.redirectTo({
                            url: "/pages/runman/order/order"
                        });
                    }
                }));
            }
        });
    },
    getOwnMsg: function() {
        n.com.post("wx/user/info", {}, function(n) {
            if (0 === n.errno) {
                n.data.phone.phone_number = n.data.phone.phone_number.substring(0, 3) + "****" + n.data.phone.phone_number.substring(7, 11), 
                e.setData(n.data);
                var a = !0, t = "/pages/runman/register/register", o = "成为跑男", i = !1;
                n.data.isRunman.id ? (a = !0, n.data.isRunman.status >= 2 ? (o = "跑男中心", t = "/pages/runman/index", 
                i = !0) : (o = "已申请为跑男，审核中", t = "/pages/runman/verify/verify", i = !1)) : a = !0, 
                e.setData({
                    "navigator[3]": {
                        icon: "/img/runman.png",
                        label: o,
                        url: t,
                        show: a
                    },
                    "navigator[6].show": i,
                    "navigator[7].show": !!n.data.agent.id
                }), e.getOpentg();
            }
        });
    },
    getOpentg: function() {
        n.com.post("wx/config/retail", {}, function(n) {
            0 === n.errno && e.setData({
                "navigator[1].show": n.data.open,
                "navigator[1].url": "/pages/mine/retail/retail?data=" + JSON.stringify(e.data.userInfo)
            });
        });
    }
});